package bean;

import java.io.Serializable;

public class PositionPk implements Serializable{
	private Customer customer;
	private Fund fund;
	
	public Customer getCustomer() {
		return customer;
	}
	
	public void setCustomer(Customer customer) {
		this.customer = customer;
	}
	
	public Fund getFund() {
		return fund;
	}
	
	public void setFund(Fund fund) {
		this.fund = fund;
	}
	
	@Override
	public boolean equals(Object o) {
		if (o instanceof PositionPk) {
			PositionPk pk = (PositionPk) o;
			return (pk.getFund().getId()== (this.getFund().getId())) && (pk.getCustomer().getId() == this.getCustomer().getId());
		}
		
		return false;
	}
	
	@Override
	public int hashCode() {
		return ("" + this.fund.getName() + this.getCustomer().getUsername()).hashCode();
	}
}
